package com.D5Power.Editor.EditorWindow
{
	import com.D5Power.Editor.Event.ClickObjectEvent;
	import com.D5Power.Objects.GameObject;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import org.aswing.FlowLayout;
	import org.aswing.JButton;
	import org.aswing.JFrame;
	import org.aswing.JPanel;
	import org.aswing.ext.Form;
	
	public class ObjectAttr extends D5EditorWin
	{
		
		/**
		 * 属性的目标对象
		 */ 
		protected var _obj:GameObject;
		
		/**
		 * @param	owner	主程序映射
		 * @param	obj		控制对象
		 */ 
		public function ObjectAttr(owner:D5RpgEditor, obj:GameObject=null)
		{
			_root = owner;
			_obj = obj;
			super(owner);
		}
		
		/**
		 * 结束初始化
		 */ 
		override protected function initEnd(mode:uint=0):void
		{
			var bt_ok:JButton = new JButton('保存');
			var bt_cancle:JButton = new JButton('取消');
			var bt_del:JButton = new JButton('移除');
			bt_del.addActionListener(onDelete);
			bt_cancle.addActionListener(onCancle);
			bt_ok.addActionListener(onSubmit);
			
			var jpanle:JPanel = new JPanel(new FlowLayout(FlowLayout.CENTER,16,5));
			jpanle.appendAll(bt_ok,bt_cancle,bt_del);
			_box.append(jpanle);
			
			setSizeWH(_box.width+_padding*2,_box.height+_padding*2);
			setLocationXY(730,150);
		}
		
		protected function onDelete(e:Event):void
		{
			if(_obj!=null) _root.Shower.scene.removeObject(_obj);
			closeReleased();
		}
		
		
		override public function closeReleased():void
		{
			_root.releaseAttrWin();
			super.closeReleased();
		}
		
		public function onMouseEvent(e:ClickObjectEvent):void
		{
			
		}
	}
}